package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.PromotionType;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.model.YgPromotionItemModel;
import com.ygqh.baby.model.YgPromotionModel;
import com.ygqh.baby.po.YgPromotion;
import com.ygqh.baby.po.YgPromotionExample;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

public interface YgPromotionMapper {
    int countByExample(YgPromotionExample example);

    int deleteByExample(YgPromotionExample example);

    int deleteByPrimaryKey(Long id);

    int insert(YgPromotion record);

    int insertSelective(YgPromotion record);

    List<YgPromotion> selectByExample(YgPromotionExample example);

    YgPromotion selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") YgPromotion record, @Param("example") YgPromotionExample example);

    int updateByExample(@Param("record") YgPromotion record, @Param("example") YgPromotionExample example);

    int updateByPrimaryKeySelective(YgPromotion record);

    int updateByPrimaryKey(YgPromotion record);

    int countSuper(@Param("supplierId") Long supplierId, @Param("pStatus") String pStatus,
                   @Param("pType") PromotionType pType, @Param("startDate") Date startDate, @Param("endDate") Date endDate,
                   @Param("q") String q, @Param("platformNos") String... platformNos);

    List<YgPromotion> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("supplierId") Long supplierId,
                                  @Param("pStatus") String pStatus, @Param("pType") PromotionType pType, @Param("startDate") Date startDate,
                                  @Param("endDate") Date endDate, @Param("q") String q, @Param("platformNos") String... platformNos);

    List<YgPromotionItemModel> selectPromotionItemList(@Param("pType") String pType, @Param("currentDate") String currentDate,
                                                       @Param("limitPrice") BigDecimal limitPrice, @Param("platformNos") String... platformNos);

    /**
     * @param productId   这里的productId为促销商品的productId
     * @param pType
     * @param currentDate
     * @param limitPrice
     * @return
     */
    List<YgPromotion> selectPromotionByProductId(@Param("productId") Long productId, @Param("pType") String pType,
                                                 @Param("currentDate") String currentDate, @Param("limitPrice") BigDecimal limitPrice, @Param("platformNos") String... platformNos);

    List<YgPromotionModel> selectOwnPromotionList(@Param("pType") PromotionType pType,
                                                  @Param("currentDate") String currentDate, @Param("platformNos") String... platformNos);

    List<YgPromotionModel> findJiajiagoPromotionList(@Param("productId") Long productId,
                                                     @Param("currentDate") String currentDate, @Param("platformNos") String... platformNos);

    List<YgPromotionModel> findManZengPromotionList(@Param("productId") Long productId,
                                                    @Param("currentDate") String currentDate, @Param("platformNos") String... platformNos);

}
